<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var isValid = function(s) {
        let len =s.length;
        if(len % 2 !==0 ){
            return false;
        }
        while(s.indexOf('()') != -1 || s.indexOf('[]') != -1 || s.indexOf('{}') != -1){
            s = s.replaceAll('()','').replaceAll('[]','').replaceAll('{}','')
        }
        if(s.length == 0){
            return true
        }else{
            return false
        }
    };
</script>
</body>
</html>
